var t = function(t) {
  return t && t.__esModule ? t : {
      default: t
  };
}(require("../../../../utils/device")), o = require("../../../../utils/util");

Component({
  properties: {
      id: String,
      zIndex: {
          type: Number,
          value: 1e9
      },
      isFromBottom: {
          type: Boolean,
          value: !0
      },
      toPosition: {
          type: Number,
          value: 300
      },
      stickyBottom: {
          type: Boolean,
          value: !1
      },
      backgroundColor: {
          type: String,
          value: "#fff"
      },
      hideWhenTapingMask: {
          type: Boolean,
          value: !0
      },
      footerFillForIpx: {
          type: Boolean,
          value: !0
      }
  },
  data: {
      showModal: !1,
      isIPhoneX: t.default.isIpx(),
      containerAnimation: null,
      modalAnimation: null,
      fadeInDuration: 300
  },
  methods: {
      setDataPromise: o.setDataPromise,
      showModal: function() {
          var t = this;
          this.setDataPromise({
              showModal: !0
          }).then(function() {
              var o = t.data.fadeInDuration, e = t.data.isFromBottom, a = wx.createAnimation().translateY(0);
              a = e ? a.bottom(0) : a.top(0), t.setData({
                  containerAnimation: wx.createAnimation().opacity(1).step({
                      duration: o
                  }).export(),
                  modalAnimation: a.step({
                      duration: o,
                      timingFunction: "ease-out"
                  }).export()
              });
          }), this.triggerEvent("show", {}, {});
      },
      hideModal: function() {
          var t = this, e = this.data.fadeInDuration, a = this.data, i = a.isFromBottom, n = a.toPosition, r = wx.createAnimation();
          r = i ? r.translateY(n).bottom(-n) : r.translateY(-n).top(-n), this.setData({
              containerAnimation: wx.createAnimation().opacity(0).step({
                  duration: e
              }).export(),
              modalAnimation: r.step({
                  duration: e,
                  timingFunction: "ease-out"
              }).export()
          }), (0, o.delay)(e).then(function() {
              t.setData({
                  showModal: !1
              });
          }), this.triggerEvent("hide", {}, {});
      }
  }
});